﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using nPress.Core.Entities;

namespace nPress.Core.Mapping
{
    public class LinkMap : MapBase<Link>
    {
        #region SQL

        /*
         CREATE TABLE links (
          link_id bigint(20) unsigned NOT NULL auto_increment,
          link_url varchar(255) NOT NULL default '',
          link_name varchar(255) NOT NULL default '',
          link_image varchar(255) NOT NULL default '',
          link_target varchar(25) NOT NULL default '',
          link_description varchar(255) NOT NULL default '',
          link_visible varchar(20) NOT NULL default 'Y',
          link_owner bigint(20) unsigned NOT NULL default '1',
          link_rating int(11) NOT NULL default '0',
          link_updated datetime NOT NULL default '0000-00-00 00:00:00',
          link_rel varchar(255) NOT NULL default '',
          link_notes mediumtext NOT NULL,
          link_rss varchar(255) NOT NULL default '',
          PRIMARY KEY  (link_id),
          KEY link_visible (link_visible)
         */

        #endregion

        public LinkMap() : base("links")
        {
            Id(x => x.Id, "link_id");
            Map(x => x.Url, "link_url").Not.Nullable();
            Map(x => x.Name, "link_name").Not.Nullable();
            Map(x => x.Image, "link_image").Not.Nullable();
            Map(x => x.Target, "link_target").Not.Nullable();
            Map(x => x.Description, "link_description").Not.Nullable();
            Map(x => x.Visible, "link_visible").Not.Nullable();
            References(x => x.Owner, "link_owner").Not.Nullable();
            Map(x => x.Rating, "link_rating").Not.Nullable();
            Map(x => x.Updated, "link_updated").Not.Nullable();
            Map(x => x.Rel, "link_rel").Not.Nullable();
            Map(x => x.Notes, "link_notes").Not.Nullable();
            Map(x => x.Rss, "link_rss").Not.Nullable();
        }
    }
}
